package com.kylin.shared.enums;

import com.kylin.shared.common.consts.Constants;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Objects;

/**
 * 性别枚举
 * @author Damon S.
 */
@Getter
@RequiredArgsConstructor
public enum GenderEnum {
    /**0未知，1男，2女*/
    MALE(1), FEMALE(2), NA(0);

    private final int value;

    public static GenderEnum parse(int code) {
        return Objects.equals(code, Constants.INT_ONE) ? MALE :
                (Objects.equals(code, Constants.INT_TWO) ? MALE : NA);
    }
}